package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 练习：向文件中写入字符数据
 */
public class Test1 {
    public static void main(String[] args) throws IOException {
        //写入文件
        /*FileOutputStream fos = new FileOutputStream("./fos.txt",true);
        for(char c = 'a';c<='z';c++){
            fos.write(c);
        }

        fos.close();
        System.out.println("数据写入完毕");*/

        //读取文件
        FileInputStream fis = new FileInputStream("./fos.txt");
        int d;
        while((d=fis.read())!=-1){
            System.out.print((char)d);
        }
        fis.close();
        System.out.println("数据读取完毕");
    }

}
